package chapter_08_bridge.p1_apply.abstractt;

import chapter_08_bridge.p1_apply.implementor.MessageImplementor;

/**
 * Created by CharloYao on 2017/3/23.
 * 抽象部分;
 */
public abstract class AbstractMessage {

    //持有一个实现部分的对象
    private MessageImplementor messageImplementor;

    public AbstractMessage(MessageImplementor messageImplementor) {
        this.messageImplementor = messageImplementor;
    }

    /**
     * 发送消息；转调实现部分的方法；
     * @param message
     * @param toUser
     */
    public void sendMessage(String message,String toUser){
        this.messageImplementor.send(message,toUser);
    }
}
